#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QDebug>
#include <QEvent>
#include <QMainWindow>
#include <QMouseEvent>
#include "mylabel.h"


QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
#if 1
    bool event(QEvent *event) override{
//        qDebug() << event->type();

        if(event->type() == QEvent::MouseMove){
            qDebug() << "event, Mouse move!";
        }


        /**
          * 调用父类event函数，不干扰原有事件分发过程
          *
          */
        return QMainWindow::event(event);
    }
#endif

#if 1
    void mouseMoveEvent(QMouseEvent* event)override{
        qDebug() << "event_handler, mouse move " << event->button()
                 << "x = " << event->x()
                 << "y = " << event->y();
    }
#endif
public slots:
    void changeLabel();
private:
    Ui::MainWindow *ui;
    MyLabel* label;
};
#endif // MAINWINDOW_H
